module(
    name = "rules_img",
    version = "0.1.4",
    compatibility_level = 1,
)

bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_go", version = "0.54.0")
bazel_dep(name = "gazelle", version = "0.43.0")
bazel_dep(name = "googleapis", version = "0.0.0-20240819-fe8ba054a")
bazel_dep(name = "protobuf", version = "29.0")
bazel_dep(name = "rules_proto", version = "7.0.2")

bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "8.0.3", dev_dependency = True)
bazel_dep(name = "aspect_bazel_lib", version = "2.20.0", dev_dependency = True)
bazel_dep(name = "rules_pkg", version = "1.1.0", dev_dependency = True)
bazel_dep(name = "rules_bazel_integration_test", version = "0.33.2", dev_dependency = True)
bazel_dep(name = "tweag-credential-helper", version = "0.0.6", dev_dependency = True)
bazel_dep(name = "rules_python", version = "1.5.1", dev_dependency = True)

module_version = use_extension("//img/private/config:defs.bzl", "module_version", dev_dependency = True)
use_repo(module_version, "rules_img_version")

prebuilt_img_tool = use_extension("@rules_img//img/private/prebuilt:prebuilt.bzl", "prebuilt_img_tool")
prebuilt_img_tool.collection(
    name = "img_toolchain",
)
prebuilt_img_tool.from_file(
    collection = "img_toolchain",
    file = "@rules_img//:prebuilt_lockfile.json",
)
use_repo(
    prebuilt_img_tool,
    "img_toolchain",
)

# register a prebuilt toolchain of the img tool.
register_toolchains(
    "@img_toolchain//:all",
)

# register a source-built toolchain of the img tool.
register_toolchains(
    "@rules_img//img/source_toolchain:all",
)

bazel_binaries = use_extension(
    "@rules_bazel_integration_test//:extensions.bzl",
    "bazel_binaries",
    dev_dependency = True,
)
bazel_binaries.download(version = "7.4.0")
bazel_binaries.download(version = "8.3.1")
use_repo(bazel_binaries, "bazel_binaries", "bazel_binaries_bazelisk", "build_bazel_bazel_7_4_0", "build_bazel_bazel_8_3_1")

go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
go_sdk.from_file(
    go_mod = "//:go.mod",
)

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(go_deps, "com_github_aws_aws_sdk_go_v2", "com_github_aws_aws_sdk_go_v2_config", "com_github_aws_aws_sdk_go_v2_service_s3", "com_github_containerd_stargz_snapshotter_estargz", "com_github_google_uuid", "com_github_klauspost_compress", "com_github_malt3_go_containerregistry", "com_github_opencontainers_go_digest", "com_github_opencontainers_image_spec", "com_google_cloud_go_longrunning", "org_golang_google_genproto_googleapis_api", "org_golang_google_genproto_googleapis_bytestream", "org_golang_google_genproto_googleapis_rpc", "org_golang_google_grpc", "org_golang_google_protobuf", "org_golang_x_sync")
